import QtQuick
import QtQuick.Controls
import Qt5Compat.GraphicalEffects

Item {
    id: root

    // anchors.fill: parent
    width: childrenRect.width
    height: childrenRect.height

    property color pureColor: Qt.rgba(1, 1, 0, 0.5)
    property var gradient: Gradient {
        GradientStop { position: 0.0; color: pureColor }
        GradientStop { position: 1.0; color: pureColor }
    }
    property var maskSource: text

    Text {
        id: text
        font.pixelSize: 50
        text: "GradientMask"
        visible: false
    }

    Rectangle {
        anchors.fill: root.maskSource
        gradient: root.gradient
        layer.enabled: true
        layer.effect: OpacityMask {
            maskSource: root.maskSource
        }
    }
}
